﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;


using System.ComponentModel;
using System.Data;

using Aspose.Words.Properties;
using System.IO;
using System.Diagnostics;

using Aspose.Words;
using Aspose.Words.Tables;
using Aspose.Words.Drawing;
using Aspose.Words.Lists;
using Aspose.Words.Fields;

namespace CLWord
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            //Open document and create Documentbuilder
            Aspose.Words.Document doc = new Aspose.Words.Document(@"D:\发布单模板.docx");
            DocumentBuilder builder = new DocumentBuilder(doc);

            //Set table formating
            //Set borders
            builder.CellFormat.Borders.LineStyle = LineStyle.Single;

            //Set left indent
            //builder.RowFormat.LeftIndent=100;
            builder.MoveToBookmark("时间48");
            builder.Write("fasdfasdfads");
            builder.Font.Size = 50;
            builder.Write("33445");
            
            builder.MoveToBookmark("时间72");
            builder.Font.Size = 44;
            builder.Write("fasdfasdfdsafasdfsd6f5sa6f5as6");
            //Move documentBuilder cursor to the bookmark
            builder.MoveToBookmark("时间24");
            //Insert some table
            builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    builder.InsertCell();
                    builder.Write(i.ToString());
                    
                }
                builder.EndRow();
            }
            builder.EndTable();

            //Save output document
            doc.Save(@"D:\1.docx");
        }
    }
}
